package com.neusoft.test;

import com.neusoft.config.SpringConfig;
import com.neusoft.service.UmsAdminService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.sql.DataSource;

/**
 * @Author: duan
 * @Date: Create in 11:53 2020/10/28
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = SpringConfig.class)
public class SpringDemo {
    @Autowired
    private UmsAdminService umsAdminService;
    @Autowired
    private DataSource dataSource;
//    @Test
//    public void t1() {
//        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
//        DataSource bean = context.getBean(DataSource.class);
//        System.out.println(bean);
//    }
//
//    @Test
//    public void t2() {
//        ApplicationContext context = new AnnotationConfigApplicationContext(SpringConfig.class);
//        UmsAdminService bean = context.getBean(UmsAdminService.class);
//        System.out.println(bean);
//        bean.delete(1L);
//    }

    @Test
    public void t3() {
        umsAdminService.delete(1L);
    }

    @Test
    public void t4() {
        System.out.println(dataSource);
    }
}
